package com.dotflat.rest.PO;

import com.dotflat.rest.utils.QueryInField;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.matt.foundation.utils.CopyUtils;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;

import java.util.List;

/**
 * 园区数据
 */
@Data
@ApiModel
@EqualsAndHashCode(callSuper = false)
public class GroupAreableObjectBasePO extends AreableObjectBasePO {

    @ApiModelProperty(value = "园区id列表", hidden = true)
    @JsonIgnore
    @QueryInField("areaId")
    private List<String> areaIds;

    public static <T> T of(AreableObjectBasePO areableObject, Class<T> tClass){

        T ret = null;
        try {
            ret = tClass.newInstance();
        } catch (InstantiationException e) {
            throw new RuntimeException(e);
        } catch (IllegalAccessException e) {
            throw new RuntimeException(e);
        }

        CopyUtils.copyProperties(areableObject, ret);

        return ret;
    }
}

